﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace PowerCreator.LMS.Web.Sys.Comment
{
    public partial class CommentManager : System.Web.UI.Page
    {
        PowerCreator.LMS.Web.Comment.Comment commentManager = new PowerCreator.LMS.Web.Comment.Comment();
        PowerCreator.LMS.Web.Course.Resource opResource = new PowerCreator.LMS.Web.Course.Resource();
        PowerCreator.LMS.Web.Course.Course opCourse = new PowerCreator.LMS.Web.Course.Course();

        //PowerCreator.LMS.Logic.CourseManager.ManagerResourceInfo resourceManager = new PowerCreator.LMS.Logic.CourseManager.ManagerResourceInfo();

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string search = GetSearch();
                BinderPager(search);
                BinderGV(search, 1);
            }
        }

        private string GetSearch()
        {
            string search = string.Empty;
            return search;
        }
        private void BinderPager(string search)
        {
            AspNetPager1.RecordCount = commentManager.QueryCommentCount(search);
            AspNetPager1.PageSize = PowerCreator.LMS.Web.Config.WebConfig.PageSize;
        }
        private void BinderGV(string search, int pageIndex)
        {
            //DataTable dt = new DataTable();
            ////dt = resourceManager.Query(search, PowerCreator.LMS.Web.Config.WebConfig.PageSize, pageIndex);
            //dt.Columns.Add("CommentCount");
            //dt.Columns.Add("NewResourceType");
            //dt.Columns.Add("NewState");
            //dt.Columns.Add("");
            //for (int i = 0; i < dt.Rows.Count; i++)
            //{
            //    //string t1 = string.Format("ResourceID={0}", dt.Rows[i]["ResourceID"]);
            //    //dt.Rows[i]["CommentCount"] = commentManager.QueryCommentCount(t1);
            //    //dt.Rows[i]["NewResourceType"] = opCourse.GetSysResourceTypeByValue(int.Parse(dt.Rows[i]["ResourceTypeID"].ToString())).ToString();
            //    //dt.Rows[i]["NewState"] = resourceManager.GetResourceType(int.Parse(dt.Rows[i]["ResourceTypeID"].ToString()));
            //}
            //rptResourceList.DataSource = dt;
            //rptResourceList.DataBind();
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            string search = GetSearch();
            BinderGV(search, AspNetPager1.CurrentPageIndex);
        }
    }
}